Skip to content

)}

IQuaternaryList.AddIndex(string, Func) method

Defined in

Type: IQuaternaryList Namespace: ReactiveList.Reactive.Collections Assembly: ReactiveList.Reactive.dll

Applies to

net11.0, net10.0, net47, net471, net472, net48, net481

void AddIndex<TIndexKey>(string indexName, Func<T?, TIndexKey> keySelector) where TIndexKey : notnull

Summary: Adds an index to the collection using the specified name and key selector.

Type parameters

NameDescription
TIndexKeyThe type of the key used for the index. Must be non-nullable.

Parameters

NameTypeDescription
indexNamestring (opens in a new tab)The unique name of the index to add. Cannot be null or empty.
keySelectorFunc (opens in a new tab)A function that extracts the key from each element in the collection. Cannot be null.

Remarks

If an index with the specified name already exists, this method may throw an exception or overwrite the existing index, depending on the implementation. Indexes can improve lookup performance for queries using the specified key.